package pub.guoxin.oops.common.sms.enums;

import lombok.Getter;

/**
 * 短信模板类型，参照aliyun短信模板类型
 * <p>
 * Created by guoxin on 18-3-13.
 */
@Getter
public enum SmsTemplateType {

    CAPTCHA(0, "验证码"),
    NOTIFICATION(0, "短信通知"),
    PROMOTION(2, "推广");

    private final int code;

    private final String name;

    private SmsTemplateType(int value, String name) {
        this.code = value;
        this.name = name;
    }

    public static SmsTemplateType valueOf(int code) {
        for (SmsTemplateType type : SmsTemplateType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        return null;
    }
}
